package com.cwt_taxi_xa;

import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;

import com.cwt_taxi_xa.constants.SPConstants;
import com.cwt_taxi_xa.data.DataUtil;
import com.cwt_taxi_xa.util.SPUtils;

public class ActivitySelectMaskCamera extends CWTBaseActivity {

    CheckBox cb_camera1, cb_camera2, cb_camera3,cb_camera4;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mask_select_camera);

        cb_camera1 = (CheckBox) findViewById(R.id.checkBox1);
        cb_camera2 = (CheckBox) findViewById(R.id.checkBox2);
        cb_camera3 = (CheckBox) findViewById(R.id.checkBox3);
        cb_camera4 = (CheckBox) findViewById(R.id.checkBox4);

        cb_camera2.setChecked(true);
        cb_camera1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
                if(arg1){
                    SPUtils.setParam(SPConstants.SPK_MASK_CAMERA,1);
                    cb_camera2.setChecked(false);
                    cb_camera3.setChecked(false);
                    cb_camera4.setChecked(false);
                }
            }
        });
        cb_camera2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
                if(arg1){
                    SPUtils.setParam(SPConstants.SPK_MASK_CAMERA,2);
                    cb_camera1.setChecked(false);
                    cb_camera3.setChecked(false);
                    cb_camera4.setChecked(false);
                }
            }
        });
        cb_camera3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
                if(arg1){
                    SPUtils.setParam(SPConstants.SPK_MASK_CAMERA,3);
                    cb_camera2.setChecked(false);
                    cb_camera1.setChecked(false);
                    cb_camera4.setChecked(false);
                }
            }
        });
        cb_camera4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
                if(arg1){
                    SPUtils.setParam(SPConstants.SPK_MASK_CAMERA,4);
                    cb_camera2.setChecked(false);
                    cb_camera3.setChecked(false);
                    cb_camera1.setChecked(false);
                }
            }
        });

        findViewById(R.id.imageView1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                finish();
            }
        });

    }

    @Override
    protected void onPause() {
        super.onPause();
        finish();
    }

    @Override
    public void setStatus(int index, boolean status) {

    }

    @Override
    public void sendMsg(int type, Object obj) {

    }
}
